package day27;

import java.io.*;

/**
 * @author ZJX
 * @version 1.0
 * @descption
 * @since 2025/11/4 11:38
 */
public class ZiJie {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        String s;
        // 循环处理每行输入（直到 EOF）
        while ((s = br.readLine().trim()) != null) {
            char[] nums = s.toCharArray();
            char left = nums[0];
            char right = nums[nums.length - 1];
            String s1 = s.substring(1, s.length() - 1);
            String[] split = s1.split(",");
            int a = Integer.parseInt(split[0].trim());
            int b = Integer.parseInt(split[1].trim());
            if (left == '(' && right == ')') {
                out.println((a + 1) + " " + (b - 1));
            } else if (left == '[' && right == ']') {
                out.println((a - 1) + " " + (b + 1));
            } else if (left == '[' && right == ')') {
                out.println((a - 1) + " " + (b - 1));
            } else {
                out.println((a + 1) + " " + (b + 1));
            }
        }
        out.close();
    }

//    public static void main(String[] args) throws IOException {
//        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//        PrintWriter out = new PrintWriter(System.out);
//        in.nextToken();
//        int n = (int) in.nval;
//        in.nextToken();
//        String s = in.sval;
//        int[] map = new int[26];
//        int a = 0;
//        int b = 0;
//        for (char c : s.toCharArray()) {
//            map[c - 'a']++;
//        }
//        for (int num : map) {
//            if (num > 0) {
//                if (num % 2 == 0) {
//                    a++;
//                } else {
//                    b++;
//                }
//            }
//        }
//        out.println(a - b+1);
//        out.close();
//    }

}

